package com.example.androidmsg.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.example.lib.socket.Mpoint;
import com.example.lib.socket.Mycallback;
import com.example.lib.socket.OcrData;

import java.util.ArrayList;
import java.util.List;

public class MyImageView extends ImageView{
    public Mycallback call;
    public MyImageView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
            float x = event.getX();
            float y = event.getY();
            OcrData od=new OcrData();
            List<Mpoint> list=new ArrayList<Mpoint>();
            Mpoint p=new Mpoint();
            p.x=x;
            p.y=y;
            list.add(p);
            od.list=list;
            call.MyCall(od);
            // 处理点击事件，使用x和y坐标
        }
        return true;
    }
}
